using System.Data.Entity.ModelConfiguration;
using Turquoise.Entities.Data;

namespace Turquoise.DataAccess.EntityFramework.Mappings
{

    public class ContentLanguageLineMapping : EntityTypeConfiguration<ContentLanguageLine>
    {

        public ContentLanguageLineMapping(string schema = "dbo")
        {
            ToTable(schema + ".ContentLanguageLine");
            HasKey(x => x.Id);

            Property(x => x.Id).HasColumnName("Id").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
            Property(x => x.ContentId).HasColumnName("ContentId").IsRequired().HasColumnType("int");
            Property(x => x.LanguageId).HasColumnName("LanguageId").IsRequired().HasColumnType("int");
            Property(x => x.ContentTitle).HasColumnName("ContentTitle").IsRequired().HasColumnType("nvarchar").HasMaxLength(255);
            Property(x => x.ContentDescription).HasColumnName("ContentDescription").IsOptional().HasColumnType("nvarchar").HasMaxLength(500);
            Property(x => x.ContentKeywords).HasColumnName("ContentKeywords").IsOptional().HasColumnType("nvarchar").HasMaxLength(500);
            Property(x => x.ContentDetail).HasColumnName("ContentDetail").IsOptional().HasColumnType("nvarchar");
            Property(x => x.CreateDate).HasColumnName("CreateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.CreatedBy).HasColumnName("CreatedBy").IsRequired().HasColumnType("int");
            Property(x => x.UpdateDate).HasColumnName("UpdateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.UpdatedBy).HasColumnName("UpdatedBy").IsRequired().HasColumnType("int");
            Property(x => x.PublishBeginDate).HasColumnName("PublishBeginDate").IsRequired().HasColumnType("datetime");
            Property(x => x.PublishEndDate).HasColumnName("PublishEndDate").IsRequired().HasColumnType("datetime");
            Property(x => x.DisplayOrder).HasColumnName("DisplayOrder").IsRequired().HasColumnType("int");
            Property(x => x.IsApproved).HasColumnName("IsApproved").IsRequired().HasColumnType("bit");

            HasRequired(a => a.Content).WithMany(b => b.ContentLanguageLines).HasForeignKey(c => c.ContentId);
            HasRequired(a => a.Language).WithMany(b => b.ContentLanguageLines).HasForeignKey(c => c.LanguageId);
            HasRequired(a => a.User_CreatedBy).WithMany(b => b.ContentLanguageLines_CreatedBy).HasForeignKey(c => c.CreatedBy);
            HasRequired(a => a.User_UpdatedBy).WithMany(b => b.ContentLanguageLines_UpdatedBy).HasForeignKey(c => c.UpdatedBy);
        }
    }

}

